/**
 * 日志收集 ：发送到Kafka主题中
 */
function logCollect(userId, action, jobCode) {
    axios.post('/log/job/detail',
        {user_id:userId,act_time:dateFormat(),action:action,job_code:jobCode})
        .then((rep) => {

        }).catch(function (error) {
            console.log(error);
        });
}

/**
 * 格式化日期
 * @returns 格式化后的日期
 */
function dateFormat() {
    let now = new Date();
    let month = (now.getMonth()+1);
    let monthStr = month+"";
    if(month < 10) {
        monthStr = "0"+month;
    }
    let day = now.getDate();
    let dayStr = day+"";
    if(day < 10) {
        dayStr = "0"+day;
    }
    let hour = now.getHours();
    let hourStr = hour+"";
    if(hourStr < 10) {
        hourStr = "0"+hour;
    }
    let minute = now.getMinutes();
    let minuteStr = minute+"";
    if(minute < 10) {
        minuteStr = "0"+minute;
    }
    let second = now.getSeconds();
    let secondStr = second+"";
    if(second < 10) {
        secondStr = "0"+second;
    }
    return now.getFullYear()+"-"+monthStr+"-"+dayStr+" "+hourStr+":"+minuteStr+":"+secondStr;
}